package com.meilai.project.mapper.payment;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.meilai.project.dto.finance.payment.PaymentApplyListDTO;
import com.meilai.project.entity.finance.payment.PaymentApply;
import com.meilai.project.vo.finance.payment.PaymentApplyVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 付款单 Mapper 接口
 * </p>
 *
 * @author xchen
 * @since 2022-02-12
 */
@Mapper
public interface PaymentApplyMapper extends BaseMapper<PaymentApply> {

    List<PaymentApplyVO> selectPageList(Page<PaymentApplyVO> page,
                                        @Param("query") PaymentApplyListDTO query);

    PaymentApplyVO getOneById(@Param("id") Long id);

    @Update("update payment_apply set write_off = 1 where id = #{id} ")
    void markWriteOff(@Param("id") Integer id);

    @Update("update payment_apply set write_off = 0 where id = #{id} ")
    void markWriteOffBack(@Param("id") Integer id);

}
